The present disclosure relates generally to the software arts, and more particularly, to methods for backstepping through a program execution.
In the field of software development, parallel programming is an approach to divide a problem into multiple parts, which can be processed simultaneously. More particularly, in parallel programming a task can be broken up into a plurality of independent threads (e.g., the threads do not share data). Each thread can run on a processor core, and no coordination between cores is needed.
Parallel programming can become more complex in the case of shared data. One existing method of performing a multi-threaded program with shared data is to use locks. Locks can be difficult to implement and can create the potential for deadlocks in programs where two threads are in a locked state waiting for the other thread to complete.
Transactional memory has been proposed to solve this kind of problem. With transactional memory, developers can mark the portions of programs that modify the shared data as being “atomic.” Each atomic block or operation is executed within a transaction: either the whole operation executes, or none of it does. Within the operation, the program can read a shared value without locking it, and perform all the computations it needs to perform. At an end of the operation, the transaction can be committed to memory (i.e., a “commit” operation).
During the commit operation, the transactional memory system can determine if the shared data has been modified since the operation was started. If the shared data hasn't been modified, the commit operation can make an update to the shared value and the thread can carry on with its work. If the shared value has changed since the block was started, the transaction is aborted, and the work the thread did can be rolled back. In the case of rollback, the program can retry the operation.
Backstepping is a method for performing a rollback, which re-executes a previously executed operation. This can be useful in the field of debugging, for example, to determine where the behavior of a program differs from expectations.
The GNU DeBugger (GDB) is the GNU (“GNU's Not Unix!”) Project debugger. GDB is popular tool for debugging software. GDB allows a user to observe each step of an executing program. GDB records a record for each instruction, enabling the user to debug backwards one instruction at a time. This type of debugging generates a large amount of data, such that the execution time becomes infeasible for large programs.